# Maintainer: Antonio Rojas <arojas@archlinux.org>

pkgname=litehtml
pkgver=0.8
pkgrel=3
pkgdesc='Fast and lightweight HTML/CSS rendering engine'
url='http://www.litehtml.com/'
arch=(loong64 x86_64)
license=(BSD)
depends=(gcc-libs
         glibc
         gumbo-parser)
makedepends=(cmake)
source=(https://github.com/litehtml/litehtml/archive/v$pkgver/$pkgname-$pkgver.tar.gz)
sha256sums=('b19edc049c0174f53941469a3c13f1f3210e8877c9c022ace93ac9cd6566b9f0')

build() {
  cmake -B build -S $pkgname-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DEXTERNAL_GUMBO=ON \
    -DBUILD_SHARED_LIBS=ON \
    -DBUILD_TESTING=OFF
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
  install -Dm644 $pkgname-$pkgver/LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
# Don't search for non-existant gumbo cmake config
  sed -e '/gumbo/d' -i "$pkgdir"/usr/lib/cmake/litehtml/litehtmlConfig.cmake
}
